<?php
namespace Common\Model;

use Think\Model\RelationModel;

class SysDepartmentModel extends RelationModel
{
    protected $_link = array(
        'sys_user' => array(
            'mapping_type' => self::HAS_MANY,
            'class_name' => 'SysUser',
            'foreign_key' => 'department_id',
            'condition' => 'state>=0 and role<99',
        ),
    );

    public function get_list()
    {
        $condition = array();
        $condition['state'] = array('egt', 0);
        $result = $this->relation(true)->where($condition)->select();
        return $result;
    }
}